<%@ page contentType = "text/html;charset=UTF-8" import="com.scalar.chiptrack.utils.ConfigManager"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<chiptrack:checkLogon sourcePage="/lotsIntransit.do" />
<%String chipTracContext = "/" + ConfigManager.getChipTracContext(); try { %>
<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>

<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>

<Script Language="javascript">
function save()
{
    var form1 = document.lotsIntransitForm.transitId;
    var count1=0;

	// if there was only 1 transitID then previously there was a problem thus this code below
	if (typeof form1.length =='undefined') {
		if (document.lotsIntransitForm.transitId.checked==true)
			count1 = count1+1;
	}

	for( var i=0; i< form1.length;i++ )
	{
		if(form1[i].checked+""=='true')
		{
			count1++;
		}

	}
	if(count1==0)
	{
		var pa=document.getElementById("errors");
		pa.innerHTML = "<li> Check one or more Checkboxes to Close Transit Lots";
		return;
	}

    document.lotsIntransitForm.action="<%=chipTracContext%>/lotsIntransit.do?action=save";
    document.lotsIntransitForm.submit();
}
/*To reset the Values */
function reset(){
    document.lotsIntransitForm.reset();
}
/*if deselect the checkbox, to deselect the SelectAll checkbox*/
function deSelectLot()
{
    var selId = document.lotsIntransitForm.transitId;
    var selAll = document.lotsIntransitForm.seclectAll;

	// if there was only 1 transitID then previously there was a problem thus this code below
	if (typeof selId.length =='undefined')
    {
      if(selId.checked == true )
      {
        document.lotsIntransitForm.select_top.checked = true;
        document.lotsIntransitForm.select_bottom.checked = true;
        return;
      }
      else
      {
        document.lotsIntransitForm.select_top.checked = false;
        document.lotsIntransitForm.select_bottom.checked = false;
        return;
      }
    }
	for( var i=0; i< selId.length;i++ )
	{
		if(selId[i].checked+""=='false')
		{
			document.lotsIntransitForm.select_top.checked = false;
            document.lotsIntransitForm.select_bottom.checked = false;
            return;
		}
        if(selId[i].checked+""=='true')
		{
			document.lotsIntransitForm.select_top.checked = true;
            document.lotsIntransitForm.select_bottom.checked = true;

		}
    }
}
/*To select all the checkboxs and deselect the all checkboxes*/
function setSelectAllIds(Object)
{
    var selId = document.lotsIntransitForm.transitId;
    var count = 0;

    if (typeof Object.length =='undefined')
    {
      if(Object.checked == true )
      {
        document.lotsIntransitForm.select_top.checked = true;
        document.lotsIntransitForm.select_bottom.checked = true;
      }
      else
      {
        document.lotsIntransitForm.select_top.checked = false;
        document.lotsIntransitForm.select_bottom.checked = false;
      }
	}
    if (typeof Object.length =='undefined')
    {

       if( Object.checked == true )
       {
           document.lotsIntransitForm.transitId.checked = true;
           for ( count = 0; count < selId.length; count ++ )
           {
                selId[count].checked = true;
           }
        }
        else
        {
           document.lotsIntransitForm.transitId.checked = false;
           for ( count = 0; count < selId.length; count ++ )
           {
                selId[count].checked = false;
           }
        }
	}
}
function searchLots()
{

   document.lotsIntransitForm.action = '<%=chipTracContext%>/lotsIntransit.do?action=search';
   document.lotsIntransitForm.submit();

}

</Script>
</HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<!-- Top Header Start-->
<%@include file="/jsp/includes/header.jsp"  %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border="0">
  <TBODY>
  <TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
        <!-- Side Navigation start -->
        <%@ include file="/jsp/operations/reports_side_menu.jsp" %>
        <!-- end of the side navigations -->
    </TD>

   <TD bgcolor="#ffffff">
        <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8>
   </TD>
   <TD bgcolor="#ffffff">
        <IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2>
   </TD>

<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" >


<!-- Start : In Transit Report -->
<html:form name="lotsIntransitForm" type="com.scalar.chiptrack.operations.reports.forms.TransitForm" action="/lotsIntransit">
<TABLE width="100%" border="0">
    <TBODY>
        <TR>
    		<TD bgcolor="#ffffff">
				<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width="8" border="0">
            </TD>
			<TD>
                <%--<IMG  src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width="500" height="1" border="0">--%>
                <!-- Start : Report Block -->
				<table width="100%" border="0" cellpadding="3" cellspacing="1">                    
                    <tr><td colspan="10" align="center" class="NArialW">Delayed Transit Lots </td></tr>
                    <tr><td colspan="10"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                    <tr><td colspan="10" class='NArialL'><FONT id="errors" styleClass="NArialL" color="#FF0000"></FONT></td></tr>
                    <tr><td colspan="10" id="svrErrors"><chiptrack:errors styleClass="NArialL"/></td></tr>
  				    <tr><td colspan="10" id="svrInfo"><chiptrack:info styleClass="NArialL"/></td></tr>
                    <tr><td colspan="10"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                    <TR>
                        <TD colspan="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
                        <TD colspan="1" nowrap class="NArialL" align="right">Process Type:</TD>
                        <TD colspan="1" class="NArialL" align="center">
                        <html:select property="processType" name="lotsIntransitForm" styleClass="txfield">
                        <html:options collection="processTypeList" property="value" labelProperty="label"/>
                        </html:select>
                        </TD>
                        <TD colspan="1" nowrap class="NArialL" align="left">From Vendor:</TD>
                        <TD colspan="1" class="NArialL" align="left">
                        <html:select property="vendorName" name="lotsIntransitForm" styleClass="txfield">
                        <html:option value="0">All Vendors</html:option>
                        <html:options collection="vendorList" property="label" labelProperty="label"/>
                        </html:select>
                        </TD>
                        <TD colspan="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
                    </TR>
                    <TR><TD colspan="10" bgcolor="#ffffff"><IMG height=3 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=10></TD></TR>
                    <TR>
                    <TD colspan="2">&nbsp;&nbsp;&nbsp;</TD>
                    <td colspan="6" align="center">
                        <a href="javascript:searchLots()"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17" onmouseover="window.status='Click to Search Delayed Transit Lots';return true" onmouseout="window.status='';return true"title="Click here to Search Delayed Transit Lots"/></a>&nbsp;&nbsp;&nbsp;&nbsp;
                        <a href="javascript:reset();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17" onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a>
                    </td>
                    </TR>
                    </TABLE>
                    <bean:size id="LotsSize" name="shippedLotsList"/>
                    <logic:greaterThan name="LotsSize" value="0">
                    <TABLE border="0">
					<tr>
						<td colspan="11" class='NArialL'><font class='NArialS'><font color='blue'>[Click on Select checkbox to close Transit Lots]</font></font></td>
					</tr>
					<tr bgcolor="#993333" align = "center">
                        <td width="3%" class='NArialL'><font color="#FFFFFF">Select</font></td>
						<td width="13%" nowrap class='NArialL'><font color="#FFFFFF">Part Number</font></td>
                        <td width="10%" nowrap class='NArialL'><font color="#FFFFFF">Lot No#</font></td>
                        <td width="10%" nowrap class='NArialL'><font color="#FFFFFF">Fab Lot No#</font></td>
                        <td width="10%" nowrap class='NArialL'><font color="#FFFFFF">PO#</font></td>
						<!--<td width="6%"><font class='NArialL'><font color="#FFFFFF">SO#</font></font></td>-->
						<td width="10%" class='NArialL'><font color="#FFFFFF">Invoice#</font></td>
                        <td width="10%" class='NArialL'><font color="#FFFFFF">Process</font></td>
						<td width="10%" class='NArialL'><font color="#FFFFFF">From Vendor</font></td>
						<td width="10%" class='NArialL'><font color="#FFFFFF">NextLoc</font></td>
						<td width="8%" class='NArialL'><font color="#FFFFFF">Ship Date</font></td>
						<td width="9%" class='NArialL'><font color="#FFFFFF">Ship Qty</font></td>
				    </tr>
                    <tr bgcolor='#DEE1E2'>
						<td colspan="11" class='NArialL'><input type="checkbox" name="select_top" onClick = "javascript:setSelectAllIds(this)">&nbsp;&nbsp Select All</td>
					</tr>
                    <logic:iterate id="transitInfo" name="shippedLotsList" indexId="iterateIdx">
                    <tr bgcolor='<%=iterateIdx.intValue() % 2 == 0 ? "#FFFFEE" : "#DEE1E2"%>'>
		                <td width ="3%" align="center" class='NArialL'><input type="checkBox" onClick = "javascript:deSelectLot()" name="transitId" value = '<bean:write name="transitInfo" property="shippedLotID" />' ></td>
                        <td align="center" class='NArialL'><bean:write name="transitInfo" property ="partNumber"/></td>
                        <td align="center" class='NArialL'><bean:write name="transitInfo" property ="lotNumber"/></td>
                        <td align="center" class='NArialL'><bean:write name="transitInfo" property ="fabLotNo"/></td>
                        <td align="center" class='NArialL'><bean:write name="transitInfo" property ="poNumber"/></td>
                        <%--<td><font class='NArialL'><bean:write name="transitInfo" property ="soNumber"/></font></td>--%>
						<td align="center" class='NArialL'><bean:write name="transitInfo" property ="invoice"/></td>
						<td align="center" class='NArialL'><bean:write name="transitInfo" property ="processName"/></td>
                        <td align="center" class='NArialL'><bean:write name="transitInfo" property ="prevoiusLocation"/></td>
                        <td align="center" class='NArialL'><bean:write name="transitInfo" property ="nextLocation"/></td>
						<td align="center" class='NArialL'><bean:write name="transitInfo" property ="shipDate"/></td>
						<td align="right" class='NArialL'><bean:write name="transitInfo" property ="shipQty"/></td>

                    </tr>
                     </logic:iterate>
                    <tr bgcolor='#DEE1E2'>
						<td colspan="11" class='NArialL'><input type="checkbox" name="select_bottom" onClick = "javascript:setSelectAllIds(this)">&nbsp;&nbsp Select All</td>
					</tr>
                   <TR><TD colspan="11" bgcolor="#ffffff"><IMG height=3 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=10></TD></TR>
                   <tr>
                   <TD colspan="2">&nbsp;&nbsp;&nbsp;</TD>
                   <td colspan="6" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                       <a href="javascript:save()" onmouseover="window.status='Click here to Close the Transit Lots';return true" onmouseout="window.status='';return true" title="Click here to Close the Transit Lots"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" width="53" height="17"></a>
                       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                       <a href="javascript:reset()" onmouseover="window.status='Click here to Reset the Transit Lots';return true" onmouseout="window.status='';return true" title="Click here to Reset the Transit Lots"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17"></a>
                   </td>
                    </tr>
                    </table>
        </logic:greaterThan>
        <logic:lessEqual name="LotsSize" value="0">
            <br><br><br>
            <table width="100%" border="0">
                <center>
                <tr align="center" >
                    <TD width="15%">&nbsp;</TD>
                    <td width="70%" class='NArialL' align="center"><FONT color="#FF0000">No Transit Lots are Found</FONT>
                    </td>
                    <TD width="15%">&nbsp;</TD>
                </tr>
                </center>
            </table>
        </logic:lessEqual>

<!-- End : Report Block -->
<BR><BR><BR>
</TD>
</TR>
</TBODY>
</TABLE>
<!-- End : Lots InTransit Report -->
</html:form>
</TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>

<!-- Footer starts here -->
<%@include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->

</BODY>
</HTML>
<%
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
%>